
<div class="CenterHeaderBox RollingGoal">
    <div class="CenterBackBtn"><a href="javascript:history.go(-1)"><img src="__CDN__/map/images/return.png" alt="返回"/></a></div>
    <div class="CenterHeaderTitle">提现明细</div>
</div>

<div class="CenterMain">
    <div class="BalanceTop gradualBg">
        <div class="BalanceNumerical am-cf">
            <div class="BalanceNum am-fl">
                <p class="p1">我的余额</p>
                <p class="p2">{$user.money}</p>
            </div>
            <div class="BalanceNumericalBtn">
                <a href="JavaScript:history.go(0)" onclick="montht()">月账单</a>
            </div>
            <div class="BalanceNumericalTime">
                <input type="text" id="my-start" style="width: 35%;background-color:white" class="am-form-field" placeholder="选择日期" data-am-datepicker readonly required />

            </div>
        </div>
    </div>
    <div class="BalanceList">
        <div class="title">提现明细</div>
        <div class="BalanceDetail"
             style="position: absolute;width:100%;height: 140%;overflow-y:auto;-webkit-overflow-scrolling: touch;padding-bottom: .98rem;box-sizing: border-box;"
        >
            <ul id="ul">


            </ul>
        </div>

    </div>
</div>
<script type="text/javascript" src="__CDN__/assets/js/zepto.min.js"></script>
<script type="text/javascript" src="__CDN__/assets/js/PullToRefresh.min.js"></script>
<script>
    var date='';
    var n=0,flag=true;
    var month=0;
    $('#my-start').datepicker().
    on('changeDate.datepicker.amui', function(event) {
        date=event.target.defaultValue;
        re_ajax(0,date,month);
        $(this).datepicker('close');
    });




    function montht() {
        month=1;
        re_ajax(0,date,month);
    }


    var refreshBox=new PullToRefresh({
        container:".BalanceDetail",
        // pull: {
        //     callback: function() {
        //         setTimeout(function() {
        //             n = 0;
        //             re_ajax(n);
        //             refreshBox.endPullRefresh(true);
        //         }, 1000);
        //     }
        // },
        up: {
            callback: function() {
                setTimeout(function() {
                    n++;
                    re_ajax(n);
                    refreshBox.endUpLoading(flag);
                }, 1000);
            }
        }
    })
    function re_ajax(page,date,month){

        $.ajax({
            type:"POST",
            url:"{$http_url}/index/user/accountdetail",
            dataType:"json",
            data:{
                page:page,
                date:date,
                month:month

            },
            success:function(data){
                if(page==1||page==0){
                    $('#ul').html('');
                }
                var html='';
                data.data.forEach(function (v) {
                    var name='';
                    if(v.status==1){
                        name='审核中';
                    }else if(v.status==2){
                        name='审核通过';
                    }else if(v.status==3){
                        name='审核失败';
                    }

                html+='<li class="am-cf">';
                html+='<div class="textL am-fl">';
                html+='  <p class="p1"><span>'+name+'</span> </p> ';
                html+='  <p class="p2">'+v.createtime+'</p>';
                html+='</div>';
                html+='<div class="textR am-fr">-'+v.money+'</div>';
                html+='</li>'
                })
                $('#ul').append(html);
                if (html == "") {
                    flag = false;
                }
            },
            error:function(jqXHR){
                console.log("Error: "+jqXHR.status);
            }
        });
    }

</script>